package com.cloud.base.service;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloud.base.entity.BaseUser;
import com.cloud.base.repository.BaseUserRepo;

@Service
public class BaseUserService {
	@Autowired
	BaseUserRepo baseUserRepo;

	public List<BaseUser> findBaseUsers() {
		Iterable<BaseUser> baseUsers = baseUserRepo.findAll();
		List<BaseUser> entitys = new ArrayList<>();
		Iterator<BaseUser> iterators = baseUsers.iterator();
		while (iterators.hasNext()) {
			entitys.add(iterators.next());
		}
		return entitys;
	}

	public List<BaseUser> myQuery() {
		return baseUserRepo.myQuery();
	}

	public BaseUser findOne(String id) {
		return baseUserRepo.findOne(id);
	}

	public void save(BaseUser baseUser) {
		baseUserRepo.save(baseUser);
	}

}
